#include <iostream>
#include<string>
using namespace std;
string countAndSay(int n) {
    string _s;
    _s = "1";
    while (--n) {
        string s;
        for (int left = 0, right = 0; right < _s.size();) {
            while ((right < _s.size()) && (_s[left] == _s[right]))
                right++;
            s += to_string(right - left);
            s += to_string(_s[left]);
            left = right;
        }
        _s = s;
    }
    return _s;
}
int main()
{
    string s= countAndSay(4);
    return 0;
}
